Crate sample_test

source ·
Expand description

Testing utilities for use with samplers defined via sample_std.

The easiest way to use these facilities is with the exported sample_test macro:

use sample_test::{sample_test, Sample};

#[sample_test]
fn test_order(#[sample(0..10)] a: usize, #[sample(20..30)] b: usize) -> bool {
    a < b
}

You may also use tester::SampleTest or tester::sample_test directly:

use sample_test::{Random, tester::sample_test};
fn test(a: usize, b: usize) -> bool {
    let sum = a + b;
    sum >= a && sum >= b
}

let mut r = Random::new();
let s = (0..10, 0..10);

sample_test(s, test as fn(usize, usize) -> bool);

Re-exports

Modules

Structs

Traits

  • Arbitrary describes types whose values can be randomly generated and shrunk.
  • User-defined strategies for generating and shrinking an Output type.

Functions

Attribute Macros